//package com.distribute.config.mongo;
//
//import com.mongodb.ConnectionString;
//import com.mongodb.MongoClientSettings;
//import com.mongodb.client.MongoClient;
//import com.mongodb.client.MongoClients;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Profile;
//import org.springframework.data.mongodb.config.AbstractMongoClientConfiguration;
//import org.springframework.data.mongodb.config.EnableMongoAuditing;
//
//@Configuration
//@Slf4j
//public class MongoConfig extends AbstractMongoClientConfiguration{
//    public static final String HOST = "127.0.0.1";
//    public static final String PORT = "27017";
//    public static final String DATABASE = "distribute_db";
//
//    @Override
//    public MongoClient mongoClient() {
//        String connUrl = String.format("mongodb://%s:%s/%s", HOST, PORT, DATABASE);
//        ConnectionString connectionString = new ConnectionString(connUrl);
//
//        final MongoClientSettings mongoClientSettings = MongoClientSettings.builder()
//                .applyConnectionString(connectionString)
//                .applyToConnectionPoolSettings(builder -> builder.maxConnectionIdleTime(6000, TimeUnit.MILLISECONDS))
//                .build();
//
//        return MongoClients.create(mongoClientSettings);
//    }
//
//    @Override
//    protected String getDatabaseName() {
//        return DATABASE;
//    }
//}
